package com.neu.cloudFactory.DAO;

import com.neu.cloudFactory.PO.Factory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface FactoryDAO extends JpaRepository<Factory,Integer> {
    //自带CRUD接口

    //关停工厂
    @Modifying
    @Query(value = "update factory set f_state = :curState where f_id = :curId", nativeQuery = true)
    void modifyState(@Param("curState") String curState, @Param("curId") int curId);

    Factory findByUserId(int id);
    Factory findByName(String name);

}
